<!-- 新人福利 2025/7/25 徐安新增 -->
<template>
  <view class="invite-bg">
    <!-- 1️⃣ 顶部 Banner -->
    <view class="banner">
      <text class="banner-title">🌟 智索真源 · 挑战者集结令 🌟</text>
      <text class="banner-desc">邀请好友，一起在实战中赢得未来！</text>
      <view class="banner-stats">
        <view class="stat-item">
          <text class="stat-label">总邀请人数</text>
          <text class="stat-num neon-blue">{{ totalInvite }}</text>
        </view>
        <view class="stat-item">
          <text class="stat-label">我的积分</text>
          <text class="stat-num neon-orange">{{ myPoints }}</text>
        </view>
      </view>
    </view>

    <!-- 2️⃣ 我的邀请战绩 -->
    <view class="my-card neon-border">
      <view class="my-info">
        <image class="avatar" :src="user.avatar" />
        <view class="my-info-main">
          <text class="my-points">积分：<text class="points-anim">{{ myPoints }}</text></text>
          <text class="my-invite">已邀请：{{ myInvite }}人</text>
          <view class="progress-bar">
            <view class="progress-inner" :style="{ width: Math.min(myInvite/10*100, 100) + '%' }"></view>
          </view>
          <text class="progress-tip">目标10人</text>
        </view>
      </view>
      <view class="my-rewards">
        <text>可领取头像框：<text class="neon-blue">{{ avatarFrames }}</text></text>
        <text>当前奖励：<text class="neon-orange">{{ canWithdraw ? '可提现' : '未达成' }}</text></text>
      </view>
      <button class="invite-btn neon-orange-btn" @tap="onInvite">立即邀请好友</button>
    </view>

    <!-- 3️⃣ 奖励机制说明卡片 -->
    <view class="reward-card">
      <view class="reward-row">
        <text class="reward-label">初始注册成功</text>
        <text class="reward-icon">🎁</text>
        <text class="reward-desc">获得10积分</text>
      </view>
      <view class="reward-row">
        <text class="reward-label">邀请1位好友注册</text>
        <text class="reward-icon">🎁</text>
        <text class="reward-desc">获得1积分 + 限定头像框</text>
      </view>
      <view class="reward-row">
        <text class="reward-label">邀请10位好友</text>
        <text class="reward-icon">💰</text>
        <text class="reward-desc">可兑换10元</text>
      </view>
    </view>

    <!-- 4️⃣ 挑战任务提示 -->
    <view class="task-tip-card neon-border">
      <text class="task-tip">你还差<text class="neon-orange">{{ leftTask }}</text>个任务即可提现</text>
      <button class="task-btn neon-blue-btn" @tap="goTask">去做任务</button>
    </view>

    <!-- 5️⃣ 分享邀请模块 -->
    <view class="share-card neon-border">
      <text class="share-title">生成专属邀请海报 / 分享小程序卡片</text>
      <button class="share-btn neon-blue-btn" open-type="share" @tap="onShare">点击分享</button>
      <view class="share-row">
        <image class="qr-img" src="/static/invite_qr.png" />
        <button class="copy-btn neon-orange-btn" @tap="onCopy">复制邀请链接</button>
      </view>
      <text class="share-stats">已分享：{{ shareCount }}次，被点击：{{ clickCount }}次</text>
    </view>

    <!-- 6️⃣ 企业入驻通道 -->
    <view class="company-card neon-border">
      <text class="company-title">🏢 企业合作通道 🔗</text>
      <text class="company-desc">数千挑战者在这里展示真实能力，您的下一个人才，或许就在这里。</text>
      <button class="company-btn neon-orange-btn" @tap="goCompany">立即入驻</button>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue'
const totalInvite = ref(1234) // 动态数字
const myPoints = ref(88) // 动态数字
const myInvite = ref(7)
const avatarFrames = ref(2)
const canWithdraw = ref(false)
const leftTask = ref(1)
const shareCount = ref(12)
const clickCount = ref(34)
const user = ref({
  avatar: '/static/avatar.png'
})
const rewardList = ref([
  { icon: '/static/gift.png', title: '初始注册成功', desc: '🎁 获得10积分' },
  { icon: '/static/add.png', title: '邀请1位好友注册', desc: '🎁 获得1积分 + 限定头像框' },
  { icon: '/static/cash.png', title: '邀请10位好友并完成任务', desc: '💰 可兑换10元' }
])
function onInvite() {
  uni.showToast({ title: '请使用微信分享功能', icon: 'none' })
}
function goTask() {
  uni.switchTab({ url: '/pages/index/index' })
}
function onShare() {
  uni.showToast({ title: '分享成功+获得积分', icon: 'none' })
}
function onCopy() {
  uni.setClipboardData({ data: 'https://your-invite-link.com' })
  uni.showToast({ title: '已复制邀请链接', icon: 'none' })
}
function goCompany() {
  uni.navigateTo({ url: '/pages/company/index' })
}
</script>

<style scoped>
/* 背景和主色调 */
.invite-bg {
  min-height: 100vh;
  background: #4a90e2; /* 深蓝背景 */
  padding-bottom: 32px;
  font-family: 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
}

/* 顶部Banner */
.banner {
  padding: 32px 0 16px 0;
  text-align: center;
}
.banner-title {
  font-size: 22px;
  color: #00FFFF; /* 霓虹蓝 */
  font-weight: bold;
  letter-spacing: 2px;
  text-shadow: 0 0 8px #00FFFF88;
}
.banner-desc {
  font-size: 15px;
  color: #fff;
  margin: 8px 0 12px 0;
  letter-spacing: 1px;
}
.banner-img {
  width: 120px;
  margin: 0 auto 12px auto;
  display: block;
  animation: float 2s infinite ease-in-out;
}
@keyframes float {
  0% { transform: translateY(0);}
  50% { transform: translateY(-10px);}
  100% { transform: translateY(0);}
}
.banner-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 8px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-label {
  color: #fff;
  font-size: 13px;
}
.stat-num {
  font-size: 22px;
  font-weight: bold;
  color: #00FFFF;
  text-shadow: 0 0 8px #00FFFF88;
  animation: jump 1s infinite alternate;
}
@keyframes jump {
  0% { transform: scale(1);}
  100% { transform: scale(1.12);}
}
.neon-blue { color: #00FFFF; text-shadow: 0 0 8px #00FFFF88;}
.neon-orange { color: #FF6A00; text-shadow: 0 0 8px #FF6A0088;}
.neon-border { border: 2px solid #00FFFF; box-shadow: 0 0 12px #00FFFF44; }
.neon-orange-btn {
  background: linear-gradient(90deg, #FF6A00 0%, #FFB347 100%);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: bold;
  margin-top: 12px;
  box-shadow: 0 0 8px #FF6A0044;
  padding: 10px 32px;
}
.neon-blue-btn {
  background: linear-gradient(90deg, #00FFFF 0%, #00BFFF 100%);
  color: #0a192f;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: bold;
  margin-top: 12px;
  box-shadow: 0 0 8px #00FFFF44;
  padding: 10px 32px;
}

/* 我的邀请战绩 */
.my-card {
  margin: 18px 16px 0 16px;
  background: #101f3a;
  border-radius: 18px;
  padding: 18px 16px 16px 16px;
  color: #fff;
  box-shadow: 0 2px 12px #00FFFF22;
  position: relative;
}
.my-info {
  display: flex;
  align-items: center;
  gap: 16px;
}
.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid #00FFFF;
  box-shadow: 0 0 12px #00FFFF88;
  animation: glow 1.5s infinite alternate;
}
@keyframes glow {
  0% { box-shadow: 0 0 8px #00FFFF44;}
  100% { box-shadow: 0 0 24px #00FFFF88;}
}
.my-info-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.my-points {
  font-size: 18px;
  font-weight: bold;
  color: #FF6A00;
  letter-spacing: 1px;
}
.points-anim {
  animation: points-jump 0.8s infinite alternate;
}
@keyframes points-jump {
  0% { transform: scale(1);}
  100% { transform: scale(1.15);}
}
.my-invite {
  font-size: 15px;
  color: #fff;
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: #1a2a44;
  border-radius: 4px;
  margin: 6px 0 2px 0;
  overflow: hidden;
  box-shadow: 0 0 4px #00FFFF44;
}
.progress-inner {
  height: 100%;
  background: linear-gradient(90deg, #00FFFF 0%, #FF6A00 100%);
  border-radius: 4px;
  transition: width 0.5s;
}
.progress-tip {
  font-size: 12px;
  color: #FF6A00;
  margin-top: 2px;
}
.my-rewards {
  display: flex;
  justify-content: space-between;
  margin: 10px 0 0 0;
  font-size: 14px;
}
.invite-btn {
  width: 100%;
  margin-top: 14px;
}

/* 奖励卡片整体样式 */
.reward-card {
  background: #062e4e;           /* 深蓝背景 */
  border-radius: 14px;           /* 圆角 */
  padding: 18px 16px;            /* 内边距 */
  margin: 12px 0;                /* 上下间距 */
  border: 2px solid #1ecfff;     /* 亮蓝色描边 */
}

/* 每一行奖励规则 */
.reward-row {
  display: flex;                 /* 横向排列 */
  align-items: center;           /* 垂直居中 */
  justify-content: flex-start;   /* 左对齐 */
  margin-bottom: 10px;           /* 行间距 */
}

/* 最后一行不需要下间距 */
.reward-row:last-child {
  margin-bottom: 0;
}

/* 左侧规则描述 */
.reward-label {
  color: #fff;                   /* 白色文字 */
  font-size: 1.08rem;            /* 字体大小 */
  font-weight: bold;             /* 加粗 */
  min-width: 120px;              /* 最小宽度，保证对齐 */
  flex-shrink: 0;                /* 不收缩 */
}

/* 奖励图标 */
.reward-icon {
  margin: 0 8px;                 /* 左右间距 */
  font-size: 1.1rem;             /* 图标大小 */
}

/* 右侧奖励描述 */
.reward-desc {
  color: #ffe082;                /* 金色/亮色文字 */
  font-size: 1rem;               /* 字体大小 */
  flex: 1;                       /* 占据剩余空间 */
  word-break: break-all;         /* 换行处理 */
}

/* 挑战任务提示 */
.task-tip-card {
  margin: 18px 16px 0 16px;
  background: #101f3a;
  border-radius: 18px;
  padding: 16px 12px;
  color: #fff;
  box-shadow: 0 2px 12px #FF6A0022;
  text-align: center;
}
.task-tip {
  font-size: 15px;
  color: #fff;
}
.task-btn {
  width: 80%;
  margin: 14px auto 0 auto;
  display: block;
}

/* 分享邀请模块 */
.share-card {
  margin: 18px 16px 0 16px;
  background: #101f3a;
  border-radius: 18px;
  padding: 16px 12px;
  color: #fff;
  box-shadow: 0 2px 12px #00FFFF22;
  text-align: center;
}
.share-title {
  font-size: 15px;
  color: #00FFFF;
  margin-bottom: 8px;
}
.share-btn {
  width: 80%;
  margin: 10px auto 0 auto;
  display: block;
}
.share-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 12px 0;
}
.qr-img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 2px solid #00FFFF;
  box-shadow: 0 0 8px #00FFFF44;
}
.copy-btn {
  padding: 8px 18px;
  font-size: 15px;
  margin-left: 0;
}
.share-stats {
  font-size: 13px;
  color: #FF6A00;
  margin-top: 4px;
}

/* 企业入驻通道 */
.company-card {
  margin: 18px 16px 0 16px;
  background: #101f3a;
  border-radius: 18px;
  padding: 16px 12px;
  color: #fff;
  box-shadow: 0 2px 12px #00FFFF22;
  text-align: center;
}
.company-title {
  font-size: 16px;
  color: #00FFFF;
  font-weight: bold;
}
.company-desc {
  font-size: 14px;
  color: #fff;
  margin: 8px 0 12px 0;
}
.company-btn {
  width: 80%;
  margin: 10px auto 0 auto;
  display: block;
}
</style>
